Skip to content

doc(CacheList): add GC button#7922

Merged
ArgoZhang merged 2 commits intomainfrom
doc-list
Apr 28, 2026
Merged

doc(CacheList): add GC button#7922
ArgoZhang merged 2 commits intomainfrom
doc-list

Conversation

@ArgoZhang
Copy link
Copy Markdown
Member

@ArgoZhang ArgoZhang commented Apr 28, 2026

Link issues

fixes #7921

Summary By Copilot

Regression?

  • Yes
  • No

Risk

  • High
  • Medium
  • Low

Verification

  • Manual (required)
  • Automated

Packaging changes reviewed?

  • Yes
  • No
  • N/A

☑️ Self Check before Merge

⚠️ Please check all items below before review. ⚠️

  • Doc is updated/provided or not needed
  • Demo is updated/provided or not needed
  • Merge the latest code from the main branch

Summary by Sourcery

New Features:

  • Expose a GC action on the cache list page via a toolbar button that is only available in development environments.

Copilot AI review requested due to automatic review settings April 28, 2026 03:25
@bb-auto bb-auto Bot added the documentation Improvements or additions to documentation label Apr 28, 2026
@bb-auto bb-auto Bot added this to the v10.5.0 milestone Apr 28, 2026
@sourcery-ai
Copy link
Copy Markdown
Contributor

sourcery-ai Bot commented Apr 28, 2026

Reviewer's guide (collapsed on small PRs)

Reviewer's Guide

Adds a development-only 'GC' button to the CacheList page that triggers a manual garbage collection, wiring it through the component code-behind and environment injection.

Sequence diagram for the new GC button interaction on CacheList

sequenceDiagram
    actor Developer
    participant Browser
    participant CacheList
    participant DotNetGC

    Developer->>Browser: Click GC button
    Browser->>CacheList: Trigger OnClickGC
    CacheList->>DotNetGC: GC.Collect()
Loading

Updated class diagram for CacheList component with GC button support

classDiagram
    class CacheList {
        - List~object?~ _cacheList
        + IStringLocalizer~CacheList~ Localizer
        + IWebHostEnvironment WebHost
        + void OnDeleteAll()
        + void OnClickGC()
        + void OnRefresh()
        + void UpdateCacheList()
    }
Loading

File-Level Changes

Change Details Files
Add a development-only toolbar button on the CacheList page to manually trigger garbage collection.
  • Inject IWebHostEnvironment into the CacheList component to access environment information.
  • Add a static OnClickGC handler that calls GC.Collect().
  • Render a new 'GC' danger-styled button in the table toolbar that is only shown when the hosting environment is Development, and wire it to the OnClickGC handler.
  • Normalize BOM/license comment at the top of the C# and Razor files.
src/BootstrapBlazor.Server/Components/Pages/CacheList.razor.cs
src/BootstrapBlazor.Server/Components/Pages/CacheList.razor

Assessment against linked issues

Issue Objective Addressed Explanation
#7921 Add a GC button to the CacheList component/page that triggers garbage collection (e.g., via GC.Collect), exposed in the UI.

Possibly linked issues


Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

Copy link
Copy Markdown
Contributor

@sourcery-ai sourcery-ai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've left some high level feedback:

  • Consider null-guarding WebHost in the Razor condition (e.g., WebHost?.IsDevelopment() == true) to avoid potential null reference issues despite the [NotNull] annotation, especially during design-time or if the component is instantiated outside normal DI paths.
  • Since the GC button is only for development, you might still want to add a brief confirmation (e.g., via a dialog or OnClick handler logic) before calling GC.Collect() to avoid accidental triggering during debugging sessions.
  • To keep UI text consistent and easier to adjust later, consider using a localized string for the GC button text instead of a hard-coded literal, even though it’s currently dev-only.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- Consider null-guarding `WebHost` in the Razor condition (e.g., `WebHost?.IsDevelopment() == true`) to avoid potential null reference issues despite the `[NotNull]` annotation, especially during design-time or if the component is instantiated outside normal DI paths.
- Since the GC button is only for development, you might still want to add a brief confirmation (e.g., via a dialog or `OnClick` handler logic) before calling `GC.Collect()` to avoid accidental triggering during debugging sessions.
- To keep UI text consistent and easier to adjust later, consider using a localized string for the `GC` button text instead of a hard-coded literal, even though it’s currently dev-only.

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a developer-only “GC” action to the CacheList documentation page to allow manually triggering garbage collection while inspecting cache behavior.

Changes:

  • Inject IWebHostEnvironment into CacheList to detect Development environment.
  • Add a conditional “GC” toolbar button (Development-only) and an OnClickGC handler that calls GC.Collect().

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
src/BootstrapBlazor.Server/Components/Pages/CacheList.razor.cs Adds environment injection and a new GC click handler.
src/BootstrapBlazor.Server/Components/Pages/CacheList.razor Shows a GC toolbar button only when running in Development.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/BootstrapBlazor.Server/Components/Pages/CacheList.razor
Comment thread src/BootstrapBlazor.Server/Components/Pages/CacheList.razor.cs
@ArgoZhang ArgoZhang merged commit 10379d0 into main Apr 28, 2026
7 of 8 checks passed
@ArgoZhang ArgoZhang deleted the doc-list branch April 28, 2026 03:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

documentation Improvements or additions to documentation

Projects

None yet

Development

Successfully merging this pull request may close these issues.

doc(CacheList): add GC button

2 participants